package com.yuren.codecrushlearn.Q5100;

/**
 * Created with Intellij IDEA.
 * Description:
 *
 * @author Sleepy Code Tom
 * @date 2025-03-29 23:32
 */
public class Q5125 {
    private static int eatPeaches(int nDays) {
        if (nDays == 1) return 1;
        return (eatPeaches(nDays - 1) + 1) * 2;
    }

    private static int eatPeaches2(int nDays) {
        int[] dp = new int[nDays + 1];
        dp[1] = 1;
        for (int i = 2; i <= nDays; i++) {
            dp[i] = (dp[i - 1] + 1) * 2;
        }
        return dp[nDays];
    }

    public static void main(String[] args) {
        for (int i = 1; i < 10; i++) {
            System.out.println(eatPeaches(i));
            System.out.println(eatPeaches2(i));
        }
    }
}
